package com.example.hello.controller;


import com.example.hello.bean.User1;
import com.example.hello.mapper.User1Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

@RestController
public class MybatisXmlController {

    @Autowired
    User1Mapper user1Mapper;


    @GetMapping("/xml/{id}")
    public User1 getUser(@PathVariable("id") int id){
        return user1Mapper.select(id);
    }

    @GetMapping("/inxml")
    public String insert(){
        Date date=new Date();
        user1Mapper.insert(date+"","123456");
        return date+"";
    }
}
